{extend name="layout" /}
{block name="content"}
<div class="mui-content">
	<form id="formid" method="post">
	<div class="uk-margin-small-top controll-atav-1">
		<div class="tm-df-size">
			<ul class="mui-table-view max">
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">付款状态</span>
							</div>
							<div class="tm-icon-item">
								<div class="tm-icon-label">
									<!-- <span class="tm-font-gray"></span> -->
									<select name="status" style="height: 30px;padding: 2px;margin-right: 20px;padding-left: 100px;">
										<option value="">请选择</option>
										{volist name=":config('PAY_STATUS')" id="v"}
										<option value="{$key}" {eq name="info.status" value="$key"} selected {/eq}>{$v}</option>
										{/volist}
									</select>
								</div>
							</div> 
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">单号</span>
							</div>
							<div class="">
								<div class="tm-font-boldx mui-ellipsis">{$info.ordersn}</div>
							</div>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex flex-align-center">
							<div class="tm-flex-1">
								<span class="tm-font-bold">线索分类</span>
							</div>
							<div class="tm-icon-item">
								<div class="tm-icon-label">
									<select name="kind" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
										<option value="">请选择</option>
										{volist name=":config('CLIENT_KIND')" id="v"}
										<option value="{$key}" {eq name="key" value="$info.kind"} selected {/eq}>{$v}</option>
										{/volist}
									</select>
								</div>
								<div class="tm-icon">
									<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
								</div>
							</div>
						</div>
					</div>
				</li>
				{eq name="info.kind" value="gouche"}
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-flex-head tm-flex-1">
									<span class="tm-font-gray">购买车型</span>
								</div>
								<div class="tm-icon-item" style="">
									<div class="tm-icon-label" style="">
										<select name="cartypeid1" style="margin-left: 5%;width: 50px;height: 30px;padding: 2px;" onchange="get_cartype(this, this.value)">
											<option value="">请选择</option>
											{volist name=":get_model_func('Cartype', 'list_datad', ['pid'=>0, 'hide'=>0], 1, 300, 'id,title', 'listorder asc,id asc')" id="v"}
											<option value="{$v.id}" {eq name="info.cartypeid1" value="$v.id"} selected {/eq}>{$v.title}</option>
											{/volist}
										</select>
										<select name="cartypeid2" style="width: 50px;height: 30px;padding: 2px;" onchange="get_cartype(this, this.value)">
											{volist name=":get_model_func('Cartype', 'list_datad', ['pid'=>$info.cartypeid1, 'hide'=>0], 1, 300, 'id,title', 'listorder asc,id asc')" id="v"}
											<option value="{$v.id}" {eq name="info.cartypeid2" value="$v.id"} selected {/eq}>{$v.title}</option>
											{/volist}
										</select>
										<select name="cartypeid3" style="width: auto;height: 30px;padding: 2px;" onchange="get_car(this, this.value)">
											{volist name=":get_model_func('Cartype', 'list_datad', ['pid'=>$info.cartypeid2, 'hide'=>0], 1, 300, 'id,title', 'listorder asc,id asc')" id="v"}
											<option value="{$v.id}" {eq name="info.cartypeid3" value="$v.id"} selected {/eq}>{$v.title}</option>
											{/volist}
										</select>
										<select name="carid" style="width: auto;height: 30px;padding: 2px;">
											{volist name=":get_model_func('Car', 'list_datad', ['pid'=>$info.cartypeid3, 'hide'=>0], 1, 300, 'id,title', 'id asc')" id="v"}
											<option value="{$v.id}" {eq name="info.carid" value="$v.id"} selected {/eq}>{$v.title}</option>
											{/volist}
										</select>
									</div>							
								</div>
							</div>
						</div>
					</a>
				</li>
				{/eq}
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">数量</span>
							</div>
							<div class="tm-icon-item">
								<div class="tm-icon-label">
									<input type="text" name="nums" value="{$info.nums}" style="height: 30px;width: 60%;float: right;text-align: right;border: none;margin-right: -20px;">
								</div>
								<div class="tm-icon">
									<img src="{$images_path}xinxin.png" alt="" width="6" height="6" />
								</div>
							</div>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">成交总额</span>
							</div>
							<div class="tm-icon-item">
								<div class="tm-icon-label">
									<input type="text" name="totalprice" value="{$info.totalprice}" style="height: 30px;width: 60%;float: right;text-align: right;border: none;margin-right: -20px;">
								</div>
								<div class="tm-icon">
									<img src="{$images_path}xinxin.png" alt="" width="6" height="6" />
								</div>
							</div>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">录入时间</span>
							</div>
							<div>
								<div class="tm-font-boldx mui-ellipsis">
									<input class="tm-font-gray" type="date" name="sucdate" value="{$info.sucdate}" style="width: 120px;height: 25px;border: none;margin-right: -40px;">
								</div>
							</div>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">付款方式</span>
							</div>
							<div>
								<div class="tm-icon-label">
									<select name="paytype" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
										<option value="">请选择</option>
										{volist name=":config('PAYTYPE')" id="v"}
										<option value="{$key}" {eq name="info.paytype" value="$key"} selected {/eq}>{$v}</option>
										{/volist}
									</select>
								</div>
							</div>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right upload_file" href="javascript:" coco_upload ajax-url="/v2/accessory/upload_acce"  ajax-callback="coco_suc" ajax-data="{}">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-flex-head tm-flex-1">
									<span class="tm-font-bold">图片上传</span>
								</div>
								<div class="tm-flex" id="images">
									{volist name="info.acce" id="v"}
									<div class="tm-atav tm-flex-head">
										<div class="tm-location-parent">
											<div class="tm-location-img" style="background-image: url({$v});"></div>
											<img class="redundant-img" src="{$images_path}px-1.png" alt="" width="100">
										</div>
									</div>
									{/volist}
								</div>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">备注</span>
							</div>
							<div class="tm-icon-item">
								<div class="tm-icon-label">
									<input type="text" name="remark" value="{$info.remark}" style="float:right;margin-right: 20px; width: 120%;height: 30px;border: none;text-align: right;padding: 0px;">
								</div>
							</div>
						</div>
					</div>
				</li>
			</ul>
		</div>
		<div class="uk-margin-small-top tm-df-size">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<div class="tm-cell-pad">
						<div class="tm-flex">
							<div class="tm-flex-head tm-flex-1">
								<span class="tm-font-gray">所有者</span>
							</div>
							<div class="tm-icon-item">
								<div class="tm-icon-label">
									<span class="tm-font-gray">{$info.uinfo.realname}</span>
									<input type="hidden" name="userid" value="{$info.userid}">
									<input type="hidden" name="brokerid" value="{$info.brokerid}">
								</div>
							</div>
						</div>
					</div>
				</li>
			</ul>
		</div>
		<input type="hidden" name="id" value="{$info.id}">
		<div class="uk-margin-large-top uk-text-center">
            <button class="mui-btn mui-btn-green btn-radiu-large pay-btn cocoPostFormAjax" formid="formid" ajaxurl="{:url('v2/client/order_update')}" type="button" style="margin-top: -20px;width: 90%; height: 45px;" ajax-callback="suc_back">
                保存
            </button>
        </div>
	</div>
	</form>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
	function coco_suc(obj, data) {
		if (data == '') {
			return false;
		}
		var html = '<div class="tm-atav tm-flex-head"><div class="tm-location-parent"><div class="tm-location-img" style="background-image: url('+data.url+');"></div><img class="redundant-img" src="{$images_path}px-1.png" alt="" width="100"></div><input type="hidden" value="'+data.id+'" name="acce[]" /></div>';
		$("#images").append(html);
	}
	function get_cartype(obj, pid) {
		$.post("{:url('v1/index/get_cartype')}", {pid: pid}, function(datajson) {
			var data = datajson.response;
			if (!data) {
				return false;
			}
			var html = '<option value="">请选择</option>';
			$.each(data, function(index, item) {
				html += '<option value="'+item.id+'">'+item.title+'</option>';
			});
			$(obj).next().html('');
			$(obj).next().append(html);
		});
	}
	function get_car(obj, pid) {
		$.post("{:url('v1/index/get_car')}", {pid: pid}, function(datajson) {
			var data = datajson.response;
			if (!data) {
				return false;
			}
			var html = '<option value="">请选择</option>';
			$.each(data, function(index, item) {
				html += '<option value="'+item.id+'">'+item.title+'</option>';
			});
			$(obj).next().html('');
			$(obj).next().append(html);
		});
	}
	function suc_back(obj, data) {
   		coco_msg('保存成功');
		setTimeout(function() {
			wx.miniProgram.navigateBack();
		}, 500);
   }
</script>
{/block}